package org.thotheolh.sweatkeeper.ui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.FlowLayout;
import javax.swing.JButton;
import net.miginfocom.swing.MigLayout;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;

public class RunWorkout extends JFrame {

	private JPanel contentPane;
	private JTextField textField;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					RunWorkout frame = new RunWorkout();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public RunWorkout() {
		setTitle("Run Workout");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));
		
		JPanel contentPanel = new JPanel();
		contentPane.add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new MigLayout("", "[][grow]", "[][]"));
		
		JLabel lblRunningDistance = new JLabel("Running Distance: ");
		contentPanel.add(lblRunningDistance, "cell 0 0,alignx trailing");
		
		textField = new JTextField();
		contentPanel.add(textField, "flowx,cell 1 0");
		textField.setColumns(10);
		
		JLabel lblKm = new JLabel("km");
		contentPanel.add(lblKm, "cell 1 0");
		
		JLabel lblTimeTaken = new JLabel("Time Taken: ");
		contentPanel.add(lblTimeTaken, "cell 0 1,alignx trailing");
		
		JSpinner hrSp = new JSpinner();
		contentPanel.add(hrSp, "flowx,cell 1 1");
		
		JLabel hrLbl = new JLabel("hr");
		contentPanel.add(hrLbl, "cell 1 1");
		
		JSpinner minSp = new JSpinner();
		minSp.setModel(new SpinnerNumberModel(0, 0, 59, 1));
		contentPanel.add(minSp, "cell 1 1");
		
		JLabel minLbl = new JLabel("min");
		contentPanel.add(minLbl, "cell 1 1");
		
		JSpinner secSp = new JSpinner();
		secSp.setModel(new SpinnerNumberModel(0, 0, 59, 1));
		contentPanel.add(secSp, "cell 1 1");
		
		JLabel secLbl = new JLabel("sec");
		contentPanel.add(secLbl, "cell 1 1");
		
		JSpinner msSp = new JSpinner();
		msSp.setModel(new SpinnerNumberModel(0, 0, 99, 1));
		contentPanel.add(msSp, "cell 1 1");
		
		JLabel msLbl = new JLabel("ms");
		contentPanel.add(msLbl, "cell 1 1");
		
		JPanel bottomPanel = new JPanel();
		FlowLayout flowLayout = (FlowLayout) bottomPanel.getLayout();
		flowLayout.setAlignment(FlowLayout.RIGHT);
		contentPane.add(bottomPanel, BorderLayout.SOUTH);
		
		JButton btnWorkoutComplete = new JButton("Workout Completed");
		bottomPanel.add(btnWorkoutComplete);
	}

}
